#pragma once
#pragma comment(lib, "winmm.lib")
//////////////////////////////////////////////////////////////////////////
// Direct3D 9 headers and libraries required
//////////////////////////////////////////////////////////////////////////
#include <d3d9.h>
#include <d3dx9.h>
#include <dinput.h>
#include <iostream>
#include <iomanip>
#include <time.h>
#include <sstream>
#include "fmod.hpp"
using namespace std;

#pragma comment(lib, "fmodex_vc.lib")
#pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 600
#define WINDOW_TITLE L"GSP 361 - Polygon Wars"
#define BOSS_DUR 100
#define BOSS2_DUR 200
#define ENEMY_SHOTS 100
#define MAX_SHOTS 40
#define MAX_ENEMIES_LVONE 35
#define GAMEOVER 0
#define PLAYING 1
#define NEXTLEVEL 2
#define NUMFILES 5
#define SAFE_RELEASE(x) if(x){x->Release(); x = 0;}
#define ERRCHECK(fmr) ((FMOD_RESULT)fmr>FMOD_OK)

struct Timer {
	float start, end;
	bool done;
	float getTime(float dt) {
		return (dt-start);
	};
	void coolDown(float dt, float e) {
		float start;
		if(!start) {
			start = dt;
		}
		if(start > e) { 
			done = true;
		}
		else {
			done = false;
		}
	};
};
/*
#########################  POLYGON WARS  #################################
	Character actions:  --- DONE
		W-A-S-D for movement   --- DONE ---
		Spacebar or LMBto shoot	--- DONE ---
		Left Ctrl or RMB to toggle between shooting modes	--- DONE ---
	Win Condition:
		Fight and survive all levels

	GAME RULES:
		Character:
			The character has a life pool, up to 5.
			if the character is hit by a projectile or collides with an enemy, the character respawns and loses a life.
			if the character's life is equal to 0, the game is over and the player loses the game.
			Shooting modes:
				Default mode: fires a projectile to the right, character turns white --- DONE ---
				Quadra mode: fires 4 projectiles to the right, character turns  yellow
				Penta mode: fires 5 projectiles(up and down, up/right, down/right, right), character turns green
				Hexa mode: fires 6 projectiles(left, up/left, down/left, right, up/right, down/right) , character turns blue
		Enemies:
			spawns on specific locations of the screen and moves according to their behavior --- DONE ---
				some can fire projectiles and just pass by the character
				some will go after the character(kamikaze)
				some will do both
			Enemies gets destroyed if hit by the player's projectiles --- DONE ---
				some enemies needs to get hit by the player's projectiles multiple times before getting destroyed. --- DONE ---
			if the enemy collides with the player's character, enemy and player's character both get destroyed.
			if an enemy is destroyed points are awared to the player. --- DONE ---
				higher the level the higher points are awarded 
				some enemies give more points
		Levels:
			a level starts off with the player spawning at the right side of the screen while progressing through the level(going to the right) --- DONE ---
			enemies will spawn depending on time since the level started --- DONE ---
			a boss encounter will occur every end of a level --- DONE ---
			some levels may have mini bosses

############################ Need to code ##########################
	These are not mentioned above:
	MENU SYSTEM:
		PLAY- CREDITS - QUIT, probably OPTIONS
			Play - starts a default game(5 lives, level 1, 0 score)
			Credits - brings up a page of credits and sources.
			Quit - closes the game.
	INGAME UI:
		shows how many lives are left(top left of the screen)
		score (middle top of the screen)
		level (top right of the screen)
		shooting mode(bottom left)
	TIME:
		how to set time and get time. -- DONE -- 

*/